<template>
  <view class="car-detail">
    <view class="car-detail-t">
      <view class="car-detail-img">
        <image :src="carPicShow" mode="widthFix" />
      </view>
      <view class="car-detail-t-r">
        <!-- 汽车品牌 + 车型 -->
        <view>{{ info.auto_brand }}{{ info.name }}</view>
        <view>{{ info.car_name }}</view>
        <view class="car-detail-t-types">
          <view>
            <!-- 几座 -->
            <text v-if="info.seat_num">{{ info.seat_num + "座 | " }} </text>
            <!-- 燃油类型 -->
            <text v-if="info.fuel_type">{{ fuelTypeName + " | " }}</text>
            <!-- 变速箱类型 -->
            <text v-if="info.transmission">{{ transmissionName + '档 | ' }}</text>
            <!-- 类型 -->
            <text v-if="info.type">{{ vehicleTypeName }}</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
export default {
  name: "rentCarPriceItem",
  props: {
    info: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  computed: {
    // 车辆图片
    carPicShow() {
      let pics = this.info.pics;
      if (pics) {
        let picsArr = pics.split(",");
        let img = picsArr[0];
        return img;
      } else {
        return "../static/images/nocarimg.png";
      }
    },
    fuelTypeName() {
      return this.dictName(this.info.fuel_type, 'FuelTypeEnum')
    },
    transmissionName() {
      return this.dictName(this.info.transmission, 'TransmissionEnum')
    },
    vehicleTypeName() {
      return this.dictName(this.info.type, 'VehicleTypeEnum')
    }
  },
  methods: {
  },
  created() {
  }
};
</script>
<style lang="less" scoped>
.car-detail {
  .car-detail-t {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    .car-detail-img {
      width: 200rpx;
      height: 150rpx;
      border-radius: 4rpx;
      background: #f6f7fb;
      overflow: hidden;
      image {
        width: 100%;
      }
    }
    .car-detail-t-r {
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      align-items: flex-start;
      margin-left: 16rpx;
      width: 330rpx;
      white-space: initial;
      view:nth-child(1) {
        color: #212329;
        font-size: 28rpx;
        font-weight: 700;
        white-space: break-spaces;
      }
      .car-detail-t-types {
        margin-top: 4rpx;
        white-space: break-spaces;
        view {
          display: inline-block;
          color: #909399;
          font-size: 24rpx;
          font-weight: 500;
        }
      }
    }
  }
}
</style>
